﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Xml.Serialization;

namespace TextProject
{
	public class Style
	{
        public Dictionary<char, Area> fontArea = new Dictionary<char, Area>();

		[XmlAttribute("fam")]
		public string FontFamily { get; set; }		
		[XmlAttribute("sz")]
		public float FontSize { get; set; }
		[XmlAttribute("st")]
		public FontStyle FontStyle { get; set; }
		[XmlElement("fc")]
		public SColor FontColor { get; set; }
		[XmlElement("bc")]
		public SColor BackColor { get; set; }

		private Font actualFont;
		private Brush actualForeBrush;
		private Brush actualBackBrush;

		[XmlIgnore]
		public Font Font
		{
			get
			{
				return actualFont;
			}
		}

		[XmlIgnore]
		public Brush ForeBrush
		{
			get
			{
				return actualForeBrush;
			}
		}

		[XmlIgnore]
		public Brush BackBrush
		{
			get
			{
				return actualBackBrush;
			}
		}

		public Style(string fontFamily, float fontSize, FontStyle fontStyle, SColor fontColor, SColor backColor)
		{
			FontFamily = fontFamily;
			FontSize = fontSize;
			FontStyle = fontStyle;
			FontColor = fontColor;
			BackColor = backColor;

			actualFont = new Font(FontFamily, FontSize, FontStyle);
			actualForeBrush = new System.Drawing.SolidBrush(FontColor.Color);
			actualBackBrush= new System.Drawing.SolidBrush(BackColor.Color);
		}
	}
}
